bitkeeper revision 1.1153 (41126318o43x3YiPCk8UwYtIQ4XdtA)
authorgm281@boulderdash.cl.cam.ac.uk <gm281@boulderdash.cl.cam.ac.uk>
Thu, 5 Aug 2004 16:40:56 +0000 (16:40 +0000)
committergm281@boulderdash.cl.cam.ac.uk <gm281@boulderdash.cl.cam.ac.uk>
Thu, 5 Aug 2004 16:40:56 +0000 (16:40 +0000)
Fixes to the warping mechanism in BVT

tools/python/xen/lowlevel/xc/xc.c
tools/python/xen/xend/Args.py
tools/python/xen/xend/server/SrvDomain.py
tools/python/xen/xm/main.py
xen/common/sched_bvt.c

index fc5bafd81ba32c9da355fc203afc8e7853f41a81..4b5a426b55ff480f44cc19a81b408758fa6c0b3c 100644 (file)
@@ -445,7 +445,7 @@ static PyObject *pyxc_bvtsched_domain_set(PyObject *self,
     static char *kwd_list[] = { "dom", "mcuadv", "warpback", "warpvalue",
                                 "warpl", "warpu", NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiill", kwd_list,
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiiLL", kwd_list,
                                       &dom, &mcuadv, &warpback, &warpvalue, 
                                       &warpl, &warpu) )
         return NULL;
index 8920a65d1bf8efacdaf53ec759d5939e3a1a2688..3e16844f74b23e8d7b7da9dfa6564b63ee988cb1 100644 (file)
@@ -72,6 +72,8 @@ class Args:
         try:
             if type == 'int':
                 val = int(v)
+            elif type == 'long':
+                val = long(v)
             elif type == 'str':
                 val = str(v)
             elif type == 'sxpr':
index 983b7e432093a6343bc569d81be1d16e413abfca..8975148819aafed29e020e16fceedc939a6b8b11 100644 (file)
@@ -112,8 +112,8 @@ class SrvDomain(SrvDir):
                      ['mcuadv', 'int'],
                      ['warpback', 'int'],
                      ['warpvalue', 'int'],
-                     ['warpl', 'int'],
-                     ['warpu', 'int']])
+                     ['warpl', 'long'],
+                     ['warpu', 'long']])
         val = fn(req.args, {'dom': self.dom.name})
         return val
     
index f331db9cd34f06dd12fe0b1395eeb3d05c020419..5fa86254135733b0c715b12191b27c66fb050d1f 100644 (file)
@@ -497,7 +497,7 @@ class ProgBvt(Prog):
 
     def main(self, args):
         if len(args) != 7: self.err("%s: Invalid argument(s)" % args[0])
-        v = map(int, args[1:7])
+        v = map(long, args[1:7])
         server.xend_domain_cpu_bvt_set(*v)
 
 xm.prog(ProgBvt)
index 7c02c70e914128ffa9e458e59ed4f7fd284e12df..9f4278ea93f9935f8c6420a27de77f0e90dd889d 100644 (file)
@@ -98,8 +98,9 @@ static inline int __task_on_runqueue(struct domain *d)
 static void warp_timer_fn(unsigned long pointer)
 {
     struct bvt_dom_info *inf = (struct bvt_dom_info *)pointer;
-
-printk("--> Warp timer fired for %d\n", inf->domain->domain);
+    unsigned long flags; 
+    
+    spin_lock_irqsave(&CPU_INFO(inf->domain->processor)->run_lock, flags);
     inf->warp = 0;
     /* unwarp equal to zero => stop warping */
     if(inf->warpu == 0)
@@ -110,7 +111,9 @@ printk("--> Warp timer fired for %d\n", inf->domain->domain);
     
     /* set unwarp timer */
     inf->unwarp_timer.expires = NOW() + inf->warpu;
+    rem_ac_timer(&inf->unwarp_timer);
     add_ac_timer(&inf->unwarp_timer);
+    spin_unlock_irqrestore(&CPU_INFO(inf->domain->processor)->run_lock, flags);
 
 reschedule:
     cpu_raise_softirq(inf->domain->processor, SCHEDULE_SOFTIRQ);   
@@ -119,13 +122,16 @@ reschedule:
 static void unwarp_timer_fn(unsigned long pointer)
 {
      struct bvt_dom_info *inf = (struct bvt_dom_info *)pointer;
+     unsigned long flags;
 
-printk("---> UnWarp timer fired for %d\n", inf->domain->domain);
+     spin_lock_irqsave(&CPU_INFO(inf->domain->processor)->run_lock, flags);
     if(inf->warpback)
     {
         inf->warp = 1;
         cpu_raise_softirq(inf->domain->processor, SCHEDULE_SOFTIRQ);   
     }
+    
+    spin_unlock_irqrestore(&CPU_INFO(inf->domain->processor)->run_lock, flags);
 }
 
 
@@ -262,9 +268,6 @@ void bvt_wake(struct domain *d)
         inf->avt = CPU_SVT(cpu);
 
     /* Deal with warping here. */
-    // TODO rewrite
-    //inf->warpback  = 1;
-    //inf->warped    = now;
     inf->evt = calc_evt(d, inf->avt);
     spin_unlock_irqrestore(&CPU_INFO(cpu)->run_lock, flags);
     
@@ -323,7 +326,6 @@ void bvt_free_task(struct domain *p)
  */
 static void bvt_do_block(struct domain *p)
 {
-    // TODO what when blocks? BVT_INFO(p)->warpback = 0; 
 }
 
 /* Control the scheduler. */
@@ -371,16 +373,17 @@ int bvt_adjdom(struct domain *p,
         
         spin_lock_irqsave(&CPU_INFO(p->processor)->run_lock, flags);   
         inf->mcu_advance = mcu_adv;
-        inf->warpback = warpback; // TODO - temporary 
-        inf->warp = 1;
+        inf->warpback = warpback;  
+        /* The warp should be the same as warpback */
+        inf->warp = warpback;
         inf->warp_value = warpvalue;
         inf->warpl = warpl;
         inf->warpu = warpu;
 
         DPRINTK("Get domain %u bvt mcu_adv=%u, warpback=%d, warpvalue=%d"
-                "warpl=%lld, warpu=%lld\n",
+                "warpl=%lld, warpu=%lld, values(%lld, %lld)\n",
                 p->domain, inf->mcu_advance, inf->warpback, inf->warp_value,
-                inf->warpl, inf->warpu);
+                inf->warpl, inf->warpu, warpl, warpu);
 
         spin_unlock_irqrestore(&CPU_INFO(p->processor)->run_lock, flags);
     }
@@ -434,7 +437,9 @@ static task_slice_t bvt_do_schedule(s_time_t now)
         prev_inf->avt = calc_avt(prev, now);
         prev_inf->evt = calc_evt(prev, prev_inf->avt);
        
-        rem_ac_timer(&prev_inf->warp_timer);
+        if(prev_inf->warpback && prev_inf->warpl > 0)
+            rem_ac_timer(&prev_inf->warp_timer);
+        
         __del_from_runqueue(prev);
         
         if ( domain_runnable(prev) )
@@ -484,6 +489,14 @@ static task_slice_t bvt_do_schedule(s_time_t now)
             min_avt = p_inf->avt;
     }
     
+    if(next_inf->warp && next_inf->warpl > 0)
+    {
+        /* Set the timer up */ 
+        next_inf->warp_timer.expires = now + next_inf->warpl;
+        /* Add it to the heap */
+        add_ac_timer(&next_inf->warp_timer);
+    }
+   
     spin_unlock_irqrestore(&CPU_INFO(cpu)->run_lock, flags);
  
     /* Extract the domain pointers from the dom infos */
@@ -543,13 +556,6 @@ static task_slice_t bvt_do_schedule(s_time_t now)
     ASSERT(r_time >= ctx_allow);
 
  sched_done:
-    if(next_inf->warp && next_inf->warpl > 0) // TODO - already added?
-    {
-        /* Set the timer up */ 
-        next_inf->warp_timer.expires = now + next_inf->warpl;
-        /* Add it to the heap */
-        add_ac_timer(&next_inf->warp_timer);
-    }
     ret.task = next;
     ret.time = r_time;
     return ret;